package com.tencent.iov.cowin.befsale.clue.repository.clue.impl;

import com.github.pagehelper.Page;
import com.tencent.iov.cowin.befsale.clue.dao.clue.ClueInitialDao;
import com.tencent.iov.cowin.befsale.clue.domain.clue.po.ClueInitial;
import com.tencent.iov.cowin.befsale.clue.repository.clue.ClueInitialManager;
import com.tencent.iov.cowin.befsale.clue.value.contants.ServiceConstant;
import com.software.boot.dao.annotation.TargetDataSource;
import org.apache.ibatis.session.RowBounds;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * @Describe: 线索源信息表_Manager实现层
 * @author: whp
 * @created: 2021-12-21 16:16:12
 * @version: 1.0
 */
@Service
public class ClueInitialManagerImpl implements ClueInitialManager {

    @Autowired
    private ClueInitialDao clueInitialDao;

    /**
     * 通过ID获取详细信息
     *
     * @param: id
     * @return: ClueInitial对象
     */
    @Override
    @TargetDataSource(ServiceConstant.QW_SALE_READ)
    public ClueInitial getDetailById(Integer id) {
        return clueInitialDao.getDetailById(id);
    }

    /**
     * 单条数据插入ClueInitial
     *
     * @param request
     * @return 插入的条数
     */
    @Override
    @TargetDataSource(ServiceConstant.QW_SALE_WRITE)
    public int insert(ClueInitial request) {
        return clueInitialDao.insert(request);
    }

    /**
     * 批量插入ClueInitial
     *
     * @param requests
     * @return 批量插入的条数
     */
    @Override
    @TargetDataSource(ServiceConstant.QW_SALE_WRITE)
    public int insertBatch(List<ClueInitial> requests) {
        return clueInitialDao.insertBatch(requests);
    }

    /**
     * 单条ClueInitial更新
     *
     * @param request
     * @return 更新的条数
     */
    @Override
    @TargetDataSource(ServiceConstant.QW_SALE_WRITE)
    public int update(ClueInitial request) {
        return clueInitialDao.update(request);
    }

    /**
     * 单条ClueInitial删除
     *
     * @param id
     * @return 删除的条数
     */
    @Override
    public int delete(Integer id) {
        return clueInitialDao.delete(id);
    }

    /**
     * 根据条件查询对象list列表
     *
     * @param request
     * @return 查询结果
     */
    @Override
    @TargetDataSource(ServiceConstant.QW_SALE_READ)
    public List<ClueInitial> getListByParam(ClueInitial request) {
        return clueInitialDao.getListByParam(request);
    }

    /**
     * 根据条件查询对象page记录
     *
     * @param request
     * @param rowBounds
     * @return 分页对象
     */
    @Override
    @TargetDataSource(ServiceConstant.QW_SALE_READ)
    public Page<ClueInitial> getPageByParam(ClueInitial request, RowBounds rowBounds) {
        return clueInitialDao.getPageByParam(request, rowBounds);
    }

    /**
     * 根据条件查询对象-单个
     *add by zly
     * 2022-01-20
     * @param request
     * @return 查询结果
     */
    @Override
    public ClueInitial getOneclueInitialByParam(ClueInitial request) {
        return clueInitialDao.getOneclueInitialByParam(request);
    }

    /**
     * add by zly
     * 2022-01-22
     * 根据条件获取线索源数据条数
     * @return
     */
    @Override
    public Integer getSyncToCrmCountByParam(ClueInitial clueInitial) {
        return clueInitialDao.getSyncToCrmCountByParam(clueInitial);
    }

    /**
     * add by zly
     * 2022-01-22
     * 根据条件分页获取线索源数据
     * @param request
     * @return
     */
    @Override
    public List<ClueInitial> getSyncToCrmPageByParam(ClueInitial request) {
        return clueInitialDao.getSyncToCrmPageByParam(request);
    }

    /**
     * add by zly
     * 2022-01-22
     * 根据id 批量修改线索源信息
     * @param listPage
     * @return
     */
    @Override
    public void updateBatch(List<ClueInitial> listPage) {
        clueInitialDao.updateBatch(listPage);
    }

    @Override
    public String getSiteCode(ClueInitial c) {
        return clueInitialDao.getSiteCode(c);
    }

    @Override
    public void updateCrmClueId(ClueInitial c) {
        clueInitialDao.updateCrmClueId(c);
    }
}
